#include "BayesianFilter.h"
#include "MainState.h"
#include "Parser.h"
#include "Thread.h"

class MainThread : public Thread
{
public:
	MainThread(MainState* mainState) 
		: Thread(false), state(mainState) {};

	static void SetDirty () { MainThread::dirty = true; };
	static void SetCleanRequested () { MainThread::cleanRequested = true; };
	static void SetPoliteStop () { MainThread::politeStop = true; };
	
protected:
	virtual void main ();	
	
	void ParseFeeds(Parser& parser);
	void AgregarNoticiasFeed(Feed& feed);
	void ClasificarNoticia(News& news,TCId feedID,TCId newsID);

	void Reclasificar();
	void ReclasificarNoticia(NewsItemConsulta& news);

	void Clean();
			
	static bool	dirty;
	static bool 	cleanRequested;
	static bool	politeStop;
	MainState*	state;

	map<TCId,TCPosicionEnLista> reclasPos;
};
